home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume89
/
comm
/
udecodbs.1
< prev
next >
Wrap
Internet Message Format
|
1989-04-29
|
3KB
Path: xanth!nic.MR.NET!indri!lll-winken!ames!oliveb!sun!rishathra!page
From: page%rishathra@Sun.COM (Bob Page)
Newsgroups: comp.sources.amiga
Subject: v89i109: uudecode-bas - amigabasic version of uudecode
Message-ID: <101954@sun.Eng.Sun.COM>
Date: 29 Apr 89 03:08:36 GMT
Sender: news@sun.Eng.Sun.COM
Lines: 78
Approved: page@sun.com
Submitted-by: creutz@bnlux0.bnl.gov (Michael Creutz)
Posting-number: Volume 89, Issue 109
Archive-name: comm/uudecode-bas.1
[You can use this to bootstap yourself -- uudecode the fast uudecode
program previously posted to comp.binaries.amiga and use that instead;
that one is faster, has error detection and even some correction
capability. Many thanks to Michael for providing this one. ..bob]
# This is a shell archive.
# Remove anything above and including the cut line.
# Then run the rest of the file through 'sh'.
# Unpacked files will be owned by you and have default permissions.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: SHell ARchive
# Run the following text through 'sh' to create:
# uudecode.bas
# This is archive 1 of a 1-part kit.
# This archive created: Fri Apr 28 20:01:20 1989
echo "extracting uudecode.bas"
sed 's/^X//' << \SHAR_EOF > uudecode.bas
X'This Amiga Basic program uudecodes
X'files. It may not be fast, but it
X'works! (I have an analogous uuencode
X'program if anyone wants it.)
X
X' Michael Creutz
X' creutz@bnlux0.bnl.gov
X
XWINDOW 1,,(20,20)-(400,150)
XDEFINT a-z
XINPUT "File to decode:",f1$
XINPUT "Decoded file name:",f2$
XOPEN f1$ FOR INPUT AS #1
XOPEN f2$ FOR OUTPUT AS #2
Xlength!=LOF(1)
Xleftlength!=length!
XPRINT "Looking for 'begin.'"
Xfindbegin:
X IF EOF(1) THEN PRINT "begin not found":CLOSE:END
X LINE INPUT #1, a$:leftlength!=leftlength!-LEN(a$)-1
X IF LEFT$(a$,6)<>"begin " THEN GOTO findbegin
X PRINT
X PRINT "'begin' found"
X PRINT "decoding ";f1$;" to file ";f2$
Xnewline:
X LOCATE 10,10
X partdone=100*(1!-leftlength!/length!)
X PRINT partdone;"% finished"
Xinline: LINE INPUT #1,a$ :leftlength!=leftlength!-LEN(a$)-1
X IF a$="" THEN GOTO inline
X IF a$="end" THEN GOTO done
X count=(ASC(LEFT$(a$,1))-32) AND 63
X IF count=0 THEN GOTO done
X pointer=2
X out$=""
Xloop:
X a1=(ASC(MID$(a$,pointer ,1))-32) AND 63
X a2=(ASC(MID$(a$,pointer+1,1))-32) AND 63
X a3=(ASC(MID$(a$,pointer+2,1))-32) AND 63
X a4=(ASC(MID$(a$,pointer+3,1))-32) AND 63
Xpointer=pointer+4
Xcount=count-3
X out$=out$+CHR$((a1* 4+a2\16) AND 255)
X out$=out$+CHR$((a2*16+a3\ 4) AND 255)
X out$=out$+CHR$((a3*64+a4 ) AND 255)
XIF count>0 THEN GOTO loop
X PRINT #2, out$;
XIF NOT EOF(1) THEN GOTO newline
X PRINT "end not found"
Xdone:
X PRINT "all done"
X CLOSE
SHAR_EOF
echo "End of archive 1 (of 1)"
# if you want to concatenate archives, remove anything after this line
exit